<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:p="http://primefaces.org/ui"
	lang="en">
	
	<ui:decorate template="/WEB-INF/facelets/faceletEditar.xhtml">
		<ui:define name="form">
			<h:form styleClass="form-horizontal">
				
				<p:messages id="mensagens"></p:messages>	
				
				<fieldset>
					<legend>Formulário de Cadastro de Cidades</legend>
					<div class="control-group">
					
						<h:outputLabel id="Nome" value="Nome:" for="Nome"
							styleClass="control-label" />
						<h:inputText id="nome" value="#{CidadeMB.entidade.nome}" styleClass="span3" maxlength="30"/>
						
					</div>
					
					<div class="control-group">
						<h:outputLabel id="UF" value="UF:" for="UF"
							styleClass="control-label" />
						<p:selectOneMenu id="scroll" value="#{CidadeMB.entidade.uf}">  
            				<f:selectItems value="#{UFMB.entidades}" 
                				var="uf" itemLabel="#{uf.nome}" itemValue="#{uf}" />
                			<f:converter converterId="entidadeConverter"></f:converter>	  
        				</p:selectOneMenu>  
					</div>
					
					<div class="control-group">
						<p:commandButton 
							value="Gravar" 
							action="#{CidadeMB.gravar}"
							update="mensagens"/>
						<span></span>
							
						<p:commandButton 
							value="Excluir" 
							action="#{CidadeMB.excluir}"
							rendered="#{CidadeMB.exibirExcluir}"
							onclick="confirmation.show()" 
							type="button">
						</p:commandButton>
							
						<p:confirmDialog 
							id="confirmDialog" 
							message="Confimar a exclusão do registro?"  
					        header="Confirmação!" 
					        severity="alert" 
					        widgetVar="confirmation">  
					                 
					    <p:commandButton 
					       	id="confirm" 
					       	value="Sim" 
					       	oncomplete="confirmation.hide()"  
					        action="#{CidadeMB.excluir}"/>  
					        
					    <p:commandButton 
					       	id="decline" 
					       	value="Não" 
					       	onclick="confirmation.hide()" 
					       	type="button" />   
					                  
					    </p:confirmDialog>  
					</div>
				</fieldset>
			</h:form>
		</ui:define>
	</ui:decorate>
</html>